{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "a504df5b",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1.2.5\n",
      "1.21.0\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "\n",
    "print(pd.__version__)\n",
    "print(np.__version__)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "1f70cd8e",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1     NaN\n",
       "2     5.0\n",
       "3    11.0\n",
       "4    19.0\n",
       "5     NaN\n",
       "dtype: float64"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s1 = pd.Series([1, 4, 9, 16], index=[1, 2, 3, 4])\n",
    "s2 = pd.Series([1, 2, 3, 4], index=[2, 3, 4, 5])\n",
    "\n",
    "# 按index对应元素相加\n",
    "s1 + s2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "0edc3310",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1     NaN\n",
       "2     3.0\n",
       "3     7.0\n",
       "4    13.0\n",
       "5     NaN\n",
       "dtype: float64"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 按index对应元素相减\n",
    "s1 - s2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "f1eebd7c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1     NaN\n",
       "2     4.0\n",
       "3    18.0\n",
       "4    48.0\n",
       "5     NaN\n",
       "dtype: float64"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 按index对应元素相乘\n",
    "s1 * s2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "eb8d565a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1         NaN\n",
       "2    4.000000\n",
       "3    4.500000\n",
       "4    5.333333\n",
       "5         NaN\n",
       "dtype: float64"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 按index对应元素相除\n",
    "\n",
    "s1 / s2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "bc895cc9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1    NaN\n",
       "2    4.0\n",
       "3    4.0\n",
       "4    5.0\n",
       "5    NaN\n",
       "dtype: float64"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 按index对应元素相除，得到商\n",
    "\n",
    "s1 // s2"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
